package com.example.mall.goods.api.service;

import com.example.mall.goods.api.entity.GoodsCategory;
import com.example.mall.goods.api.vo.MallIndexCategoryVO;
import com.example.mall.goods.api.vo.SearchPageCategoryVO;
import com.example.mall.util.PageQueryUtil;
import com.example.mall.util.PageResult;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

@FeignClient(name = "mall-goods-core")
public interface MallCategoryService {

    @PostMapping("/category/getCategoriesPage")
    PageResult getCategoriesPage(@RequestBody PageQueryUtil pageUtil);

    @PostMapping("/category/saveCategory")
    String saveCategory(@RequestBody GoodsCategory goodsCategory);

    @PostMapping("/category/updateGoodsCategory")
    String updateGoodsCategory(@RequestBody GoodsCategory goodsCategory);

    @PostMapping("/category/getGoodsCategoryById")
    GoodsCategory getGoodsCategoryById(@RequestParam("id") Long id);

    @PostMapping("/category/deleteBatch")
    Boolean deleteBatch(@RequestBody Integer[] ids);

    @PostMapping("/category/getCategoriesForIndex")
    List<MallIndexCategoryVO> getCategoriesForIndex();

    @PostMapping("/category/getCategoriesForSearch")
    SearchPageCategoryVO getCategoriesForSearch(@RequestParam("categoryId") Long categoryId);

    @PostMapping("/category/selectByLevelAndParentIdsAndNumber")
    List<GoodsCategory> selectByLevelAndParentIdsAndNumber(@RequestParam("parentIds") List<Long> parentIds,
                                                           @RequestParam("categoryLevel") int categoryLevel);
}
